package cc.xuanhaojituan.redis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

/**
 * @author chenli
 * @create 2017-09-14
 */
@RestController
public class IndexController {

    @Autowired
    private JedisConnectionFactory jedisConnectionFactory;
    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired
    private JedisPool jedisPool;

    @GetMapping("/set")
    public String set(String name){
        Jedis jedis = jedisPool.getResource();
        jedis.set("test","12352456635656555655555");
        return "SUCCESS";
    }
    @GetMapping("/get")
    public String get(){
        Jedis jedis = jedisPool.getResource();
        return jedis.get("test");
    }
}